﻿using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using Common;

namespace Dictionary
{
    public class xucSymbolItem : xucBase
    {
        private readonly IContainer components = null;
        public LabelControl lbSymbolCode;
        public LabelControl lbSymbolName;
        private string m_SymbolCode;
        private string m_SymbolName;

        public xucSymbolItem()
        {
            InitializeComponent();
            m_SymbolCode = "";
            m_SymbolName = "";
        }

        public string SymbolCode
        {
            get { return m_SymbolCode; }
            set
            {
                m_SymbolCode = value;
                Init();
            }
        }

        public string SymbolName
        {
            get { return m_SymbolName; }
            set
            {
                m_SymbolName = value;
                Init();
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Init()
        {
            lbSymbolCode.Text = m_SymbolCode;
            lbSymbolName.Text = m_SymbolName;
        }

        private void InitializeComponent()
        {
            lbSymbolName = new LabelControl();
            lbSymbolCode = new LabelControl();
            base.SuspendLayout();
            lbSymbolName.AllowHtmlString = true;
            lbSymbolName.Appearance.Options.UseTextOptions = true;
            lbSymbolName.Appearance.TextOptions.Trimming = Trimming.EllipsisCharacter;
            lbSymbolName.Appearance.TextOptions.WordWrap = WordWrap.NoWrap;
            lbSymbolName.AutoSizeMode = LabelAutoSizeMode.None;
            lbSymbolName.Dock = DockStyle.Fill;
            lbSymbolName.Location = new Point(0, 0);
            lbSymbolName.Name = "lbSymbolName";
            lbSymbolName.Size = new Size(0x66, 13);
            lbSymbolName.TabIndex = 0;
            lbSymbolName.Text = "lbSymbolName";
            lbSymbolCode.AllowHtmlString = true;
            lbSymbolCode.AutoSizeMode = LabelAutoSizeMode.None;
            lbSymbolCode.Dock = DockStyle.Right;
            lbSymbolCode.Location = new Point(0x66, 0);
            lbSymbolCode.Name = "lbSymbolCode";
            lbSymbolCode.Size = new Size(0x3e, 13);
            lbSymbolCode.TabIndex = 1;
            lbSymbolCode.Text = "lbSymbolCode";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(lbSymbolName);
            base.Controls.Add(lbSymbolCode);
            base.Name = "xucSymbolItem";
            base.Size = new Size(0xa4, 13);
            base.ResumeLayout(false);
        }
    }
}